import React, { Component } from "react";
import NavBar from "./NavBar";
import NavBar2 from "./NavBar2";

export class App extends Component {
  // 插槽的元素
  slotArray = [
    <i>我是左边</i>,
    <button>我是中间</button>,
    <span>我是右边</span>
  ]

  render() {
    return (
      <div>
        <h1>第一种方式</h1>
        <NavBar>
          <i>我是左边</i>
          <button>我是中间</button>
          <span>我是右边</span>
        </NavBar>
        <h1>第二种方式</h1>
        <NavBar2 slot={(item) => <button>{item}</button>}></NavBar2>
      </div>
    );
  }
}

export default App;
